<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="description" content="API docs for the debugAssertDoesMeetConstraints method from the SpriteBox class, for the Dart programming language.">
  <title>debugAssertDoesMeetConstraints method - SpriteBox class - flutter_sprites library - Dart API</title>
  <!-- required because all the links are pseudo-absolute -->
  <base href="../..">

  <link rel='stylesheet' href='https://fonts.googleapis.com/css?family=Source+Code+Pro|Roboto:500,400italic,300,400' type='text/css'>
  <link rel="stylesheet" href="static-assets/prettify.css">
  <link rel="stylesheet" href="static-assets/css/bootstrap.min.css">
  <link rel="stylesheet" href="static-assets/styles.css">
  <link rel="icon" href="static-assets/favicon.png">

  <!-- Do not remove placeholder -->
  <!-- Header Placeholder -->
</head>

<body>

<div id="overlay-under-drawer"></div>

<header class="container-fluid" id="title">
  <nav class="navbar navbar-fixed-top">
    <div class="container">
      <div class="row">
        <div class="col-sm-12 contents">
          <button id="sidenav-left-toggle" type="button">&nbsp;</button>
          <ol class="breadcrumbs gt-separated hidden-xs">
            <li><a href="index.html">flutter_sprites</a></li>
            <li><a href="flutter_sprites/flutter_sprites-library.html">flutter_sprites</a></li>
            <li><a href="flutter_sprites/SpriteBox-class.html">SpriteBox</a></li>
            <li class="self-crumb">debugAssertDoesMeetConstraints</li>
          </ol>
          <div class="self-name">debugAssertDoesMeetConstraints</div>
          <form class="search navbar-right" role="search">
            <input type="text" id="search-box" autocomplete="off" disabled class="form-control typeahead" placeholder="Loading search...">
          </form>
        </div> <!-- /col -->
      </div> <!-- /row -->
    </div> <!-- /container -->
  </nav>

  <div class="container masthead">
    <div class="row">
      <div class="col-sm-12 contents">
        <ol class="breadcrumbs gt-separated visible-xs">
          <li><a href="index.html">flutter_sprites</a></li>
          <li><a href="flutter_sprites/flutter_sprites-library.html">flutter_sprites</a></li>
          <li><a href="flutter_sprites/SpriteBox-class.html">SpriteBox</a></li>
          <li class="self-crumb">debugAssertDoesMeetConstraints</li>
        </ol>
        <div class="title-description">
          <h1 class="title">
            <span class="kind">method</span> debugAssertDoesMeetConstraints
          </h1>
        </div>
        <ul class="subnav">
          <li><a href="flutter_sprites/SpriteBox/debugAssertDoesMeetConstraints.html#source">Source</a></li>
        </ul>
      </div> <!-- /col -->
    </div> <!-- /row -->
  </div> <!-- /container -->

</header>

<div class="container body">
  <div class="row">

  <div class="col-xs-6 col-sm-3 col-md-2 sidebar sidebar-offcanvas-left">
    <h5><a href="index.html">flutter_sprites</a></h5>
    <h5><a href="flutter_sprites/flutter_sprites-library.html">flutter_sprites</a></h5>
    <h5><a href="flutter_sprites/SpriteBox-class.html">SpriteBox</a></h5>

    <ol>
    
    
    
      <li class="section-title"><a href="flutter_sprites/SpriteBox-class.html#constructors">Constructors</a></li>
      <li><a href="flutter_sprites/SpriteBox/SpriteBox.html">SpriteBox</a></li>
    
      <li class="section-title">
        <a href="flutter_sprites/SpriteBox-class.html#instance-properties">Properties</a>
      </li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/alwaysNeedsCompositing.html">alwaysNeedsCompositing</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/attached.html">attached</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/constraints.html">constraints</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugCanParentUseSize.html">debugCanParentUseSize</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugCreator.html">debugCreator</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugDoingThisLayout.html">debugDoingThisLayout</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugDoingThisPaint.html">debugDoingThisPaint</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugDoingThisResize.html">debugDoingThisResize</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugSemantics.html">debugSemantics</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/depth.html">depth</a></li>
      <li><a href="flutter_sprites/SpriteBox/frameRate.html">frameRate</a></li>
      <li class="inherited"><a href="dart-core/Object/hashCode.html">hashCode</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/hasSize.html">hasSize</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/isRepaintBoundary.html">isRepaintBoundary</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/isSemanticBoundary.html">isSemanticBoundary</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/layer.html">layer</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/needsCompositing.html">needsCompositing</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/needsLayout.html">needsLayout</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/owner.html">owner</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/paintBounds.html">paintBounds</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/parent.html">parent</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/parentData.html">parentData</a></li>
      <li><a href="flutter_sprites/SpriteBox/rootNode.html">rootNode</a></li>
      <li class="inherited"><a href="dart-core/Object/runtimeType.html">runtimeType</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/semanticBounds.html">semanticBounds</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/semanticsAnnotator.html">semanticsAnnotator</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/size.html">size</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/sizedByParent.html">sizedByParent</a></li>
      <li><a href="flutter_sprites/SpriteBox/transformMatrix.html">transformMatrix</a></li>
      <li><a href="flutter_sprites/SpriteBox/transformMode.html">transformMode</a></li>
      <li><a href="flutter_sprites/SpriteBox/visibleArea.html">visibleArea</a></li>
    
      <li class="section-title inherited"><a href="flutter_sprites/SpriteBox-class.html#operators">Operators</a></li>
      <li class="inherited"><a href="dart-core/Object/operator_equals.html">operator ==</a></li>
    
      <li class="section-title"><a href="flutter_sprites/SpriteBox-class.html#instance-methods">Methods</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/adoptChild.html">adoptChild</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/applyPaintTransform.html">applyPaintTransform</a></li>
      <li><a href="flutter_sprites/SpriteBox/attach.html">attach</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/clearSemantics.html">clearSemantics</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/computeDistanceToActualBaseline.html">computeDistanceToActualBaseline</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/computeMaxIntrinsicHeight.html">computeMaxIntrinsicHeight</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/computeMaxIntrinsicWidth.html">computeMaxIntrinsicWidth</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/computeMinIntrinsicHeight.html">computeMinIntrinsicHeight</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/computeMinIntrinsicWidth.html">computeMinIntrinsicWidth</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugAssertDoesMeetConstraints.html">debugAssertDoesMeetConstraints</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugDescribeChildren.html">debugDescribeChildren</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugFillDescription.html">debugFillDescription</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugHandleEvent.html">debugHandleEvent</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugPaint.html">debugPaint</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugPaintBaselines.html">debugPaintBaselines</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugPaintPointers.html">debugPaintPointers</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugPaintSize.html">debugPaintSize</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugRegisterRepaintBoundaryPaint.html">debugRegisterRepaintBoundaryPaint</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/debugResetSize.html">debugResetSize</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/describeApproximatePaintClip.html">describeApproximatePaintClip</a></li>
      <li><a href="flutter_sprites/SpriteBox/detach.html">detach</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/dropChild.html">dropChild</a></li>
      <li><a href="flutter_sprites/SpriteBox/findNodesAtPosition.html">findNodesAtPosition</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/getDistanceToActualBaseline.html">getDistanceToActualBaseline</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/getDistanceToBaseline.html">getDistanceToBaseline</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/getMaxIntrinsicHeight.html">getMaxIntrinsicHeight</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/getMaxIntrinsicWidth.html">getMaxIntrinsicWidth</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/getMinIntrinsicHeight.html">getMinIntrinsicHeight</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/getMinIntrinsicWidth.html">getMinIntrinsicWidth</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/globalToLocal.html">globalToLocal</a></li>
      <li><a href="flutter_sprites/SpriteBox/handleEvent.html">handleEvent</a></li>
      <li><a href="flutter_sprites/SpriteBox/hitTest.html">hitTest</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/hitTestChildren.html">hitTestChildren</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/hitTestSelf.html">hitTestSelf</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/invokeLayoutCallback.html">invokeLayoutCallback</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/layout.html">layout</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/localToGlobal.html">localToGlobal</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/markNeedsCompositingBitsUpdate.html">markNeedsCompositingBitsUpdate</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/markNeedsLayout.html">markNeedsLayout</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/markNeedsPaint.html">markNeedsPaint</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/markNeedsSemanticsUpdate.html">markNeedsSemanticsUpdate</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/markParentNeedsLayout.html">markParentNeedsLayout</a></li>
      <li class="inherited"><a href="dart-core/Object/noSuchMethod.html">noSuchMethod</a></li>
      <li><a href="flutter_sprites/SpriteBox/paint.html">paint</a></li>
      <li><a href="flutter_sprites/SpriteBox/performLayout.html">performLayout</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/performResize.html">performResize</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/reassemble.html">reassemble</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/redepthChild.html">redepthChild</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/redepthChildren.html">redepthChildren</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/replaceRootLayer.html">replaceRootLayer</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/rotate.html">rotate</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/scheduleInitialLayout.html">scheduleInitialLayout</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/scheduleInitialPaint.html">scheduleInitialPaint</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/scheduleInitialSemantics.html">scheduleInitialSemantics</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/setupParentData.html">setupParentData</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/toString.html">toString</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/toStringDeep.html">toStringDeep</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/toStringShallow.html">toStringShallow</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/visitChildren.html">visitChildren</a></li>
      <li class="inherited"><a href="flutter_sprites/SpriteBox/visitChildrenForSemantics.html">visitChildrenForSemantics</a></li>
    </ol>

  </div><!--/.sidebar-offcanvas-->

  <div class="col-xs-12 col-sm-9 col-md-8 main-content">
    <section class="multi-line-signature">
      <div>
        <ol class="annotation-list">
          <li>override</li>
        </ol>
      </div>
      <span class="returntype">void</span>
      <span class="name ">debugAssertDoesMeetConstraints</span>(<wbr>)
    </section>
    <section class="desc markdown">
      <p>Verify that the object's constraints are being met. Override
this function in a subclass to verify that your state matches
the constraints object. This function is only called in checked
mode and only when needsLayout is false. If the constraints are
not met, it should assert or throw an exception.</p>
    </section>
    
    <section class="summary source-code" id="source">
      <h2><span>Source</span> </h2>
      <pre class="prettyprint language-dart">@override
void debugAssertDoesMeetConstraints() {
  assert(constraints != null);
  assert(() {
    if (!hasSize) {
      assert(!needsLayout); &#47;&#47; this is called in the size= setter during layout, but in that case we have a size
      String contract;
      if (sizedByParent)
        contract = &#39;Because this RenderBox has sizedByParent set to true, it must set its size in performResize().\n&#39;;
      else
        contract = &#39;Because this RenderBox has sizedByParent set to false, it must set its size in performLayout().\n&#39;;
      throw new FlutterError(
        &#39;RenderBox did not set its size during layout.\n&#39;
        &#39;$contract&#39;
        &#39;It appears that this did not happen; layout completed, but the size property is still null.\n&#39;
        &#39;The RenderBox in question is:\n&#39;
        &#39;  $this&#39;
      );
    }
    &#47;&#47; verify that the size is not infinite
    if (_size.isInfinite) {
      StringBuffer information = new StringBuffer();
      if (!constraints.hasBoundedWidth) {
        RenderBox node = this;
        while (!node.constraints.hasBoundedWidth &amp;&amp; node.parent is RenderBox)
          node = node.parent;
        information.writeln(&#39;The nearest ancestor providing an unbounded width constraint is:&#39;);
        information.writeln(&#39;  $node&#39;);
        List&lt;String&gt; description = &lt;String&gt;[];
        node.debugFillDescription(description);
        for (String line in description)
          information.writeln(&#39;  $line&#39;);
      }
      if (!constraints.hasBoundedHeight) {
        RenderBox node = this;
        while (!node.constraints.hasBoundedHeight &amp;&amp; node.parent is RenderBox)
          node = node.parent;
        information.writeln(&#39;The nearest ancestor providing an unbounded height constraint is:&#39;);
        information.writeln(&#39;  $node&#39;);
        List&lt;String&gt; description = &lt;String&gt;[];
        node.debugFillDescription(description);
        for (String line in description)
          information.writeln(&#39;  $line&#39;);
      }
      throw new FlutterError(
        &#39;$runtimeType object was given an infinite size during layout.\n&#39;
        &#39;This probably means that it is a render object that tries to be &#39;
        &#39;as big as possible, but it was put inside another render object &#39;
        &#39;that allows its children to pick their own size.\n&#39;
        &#39;$information&#39;
        &#39;The constraints that applied to the $runtimeType were:\n&#39;
        &#39;  $constraints\n&#39;
        &#39;The exact size it was given was:\n&#39;
        &#39;  $_size\n&#39;
        &#39;See https:&#47;&#47;flutter.io&#47;layout&#47; for more information.&#39;
      );
    }
    &#47;&#47; verify that the size is within the constraints
    if (!constraints.isSatisfiedBy(_size)) {
      throw new FlutterError(
        &#39;$runtimeType does not meet its constraints.\n&#39;
        &#39;Constraints: $constraints\n&#39;
        &#39;Size: $_size\n&#39;
        &#39;If you are not writing your own RenderBox subclass, then this is not &#39;
        &#39;your fault. Contact support: https:&#47;&#47;github.com&#47;flutter&#47;flutter&#47;issues&#47;new&#39;
      );
    }
    if (_debugNeedsIntrinsicSizeCheck || debugCheckIntrinsicSizes) {
      &#47;&#47; verify that the intrinsics are sane
      assert(!RenderObject.debugCheckingIntrinsics);
      RenderObject.debugCheckingIntrinsics = true;
      StringBuffer failures = new StringBuffer();
      int failureCount = 0;

      double testIntrinsic(double function(double extent), String name, double constraint) {
        final double result = function(constraint);
        if (result &lt; 0) {
          failures.writeln(&#39; * $name($constraint) returned a negative value: $result&#39;);
          failureCount += 1;
        }
        if (!result.isFinite) {
          failures.writeln(&#39; * $name($constraint) returned a non-finite value: $result&#39;);
          failureCount += 1;
        }
        return result;
      }

      void testIntrinsicsForValues(double getMin(double extent), double getMax(double extent), String name, double constraint) {
        final double min = testIntrinsic(getMin, &#39;getMinIntrinsic$name&#39;, constraint);
        final double max = testIntrinsic(getMax, &#39;getMaxIntrinsic$name&#39;, constraint);
        if (min &gt; max) {
          failures.writeln(&#39; * getMinIntrinsic$name($constraint) returned a larger value ($min) than getMaxIntrinsic$name($constraint) ($max)&#39;);
          failureCount += 1;
        }
      }

      testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, &#39;Width&#39;, double.INFINITY);
      testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, &#39;Height&#39;, double.INFINITY);
      if (constraints.hasBoundedWidth)
        testIntrinsicsForValues(getMinIntrinsicWidth, getMaxIntrinsicWidth, &#39;Width&#39;, constraints.maxWidth);
      if (constraints.hasBoundedHeight)
        testIntrinsicsForValues(getMinIntrinsicHeight, getMaxIntrinsicHeight, &#39;Height&#39;, constraints.maxHeight);

      &#47;&#47; TODO(ianh): Test that values are internally consistent in more ways than the above.

      RenderObject.debugCheckingIntrinsics = false;
      _debugNeedsIntrinsicSizeCheck = false;
      if (failures.isNotEmpty) {
        assert(failureCount &gt; 0);
        throw new FlutterError(
          &#39;The intrinsic dimension methods of the $runtimeType class returned values that violate the intrinsic protocol contract.\n&#39;
          &#39;The following ${failureCount &gt; 1 ? &quot;failures&quot; : &quot;failure&quot;} was detected:\n&#39;
          &#39;$failures&#39;
          &#39;If you are not writing your own RenderBox subclass, then this is not\n&#39;
          &#39;your fault. Contact support: https:&#47;&#47;github.com&#47;flutter&#47;flutter&#47;issues&#47;new&#39;
        );
      }
    }
    return true;
  });
}</pre>
    </section>

  </div> <!-- /.main-content -->

</div> <!-- row -->
</div> <!-- container -->

<footer>
  <div class="container-fluid">
    <div class="container">
      <p class="text-center">
        <span class="no-break">
          flutter_sprites 0.0.15
        </span>
        &bull;
        <span class="no-break">
          <a href="https://www.dartlang.org">
            <img src="static-assets/favicon.png" alt="Dart" title="Dart" width="16" height="16">
          </a>
        </span>
        &bull;
        <span class="copyright no-break">
          <a href="http://creativecommons.org/licenses/by-sa/4.0/">cc license</a>
        </span>
      </p>
    </div>
  </div>
</footer>

<script src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="static-assets/typeahead.bundle.min.js"></script>
<script src="static-assets/prettify.js"></script>
<script src="static-assets/URI.js"></script>
<script src="static-assets/script.js"></script>
<!-- Do not remove placeholder -->
<!-- Footer Placeholder -->

</body>

</html>
